<template lang="html">
  <div></div>
</template>

<script>
function parseToMoney (num) {
  return num.toString().replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,');
}

function parseToMoney2 (num) {
  return num.toLocaleString();
}

export default {
  created () {
    console.log(parseToMoney(12345678));
    console.log(parseToMoney2(12345678));

    console.log(parseToMoney(1234.56));
    console.log(parseToMoney2(1234.56));

    console.log(parseToMoney(0.1235));
    console.log(parseToMoney2(0.1235));
  }
}
</script>

<style lang="css">
</style>
